

export const SET_USERINFO = 'SET_USERINFO'
import Cookies from 'js-cookie'
export default {
  state() {
    return {
      userInfo: ""
    }
  },

  mutations: {
    [SET_USERINFO]: (state: any, userInfo: UserInfo) => {
      Cookies.set('userInfo', userInfo, { expires: new Date((new Date().getTime() + 120 * 60 * 1000)) })
    }
  },

  actions: {
    Login({ commit }: any, userInfo: UserInfo) {
      return new Promise((resolve: any, reject: any) => {
        commit("SETUSER", userInfo);
        resolve();
      })
    }
  },
}